﻿using B.S.DataBasic.Domain.GoodInfra;
using B.S.DataBasic.Domain.RBAC;
using B.S.DataBasic.ErrorCode;
using B.S.DataBasic.Infrastructure;
using B.S.DataBasic.Infrastructure.Implement;
using B.S.DataBasic.Read.API.Application;
using B.S.DataBasic.Read.API.Dtos;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Security.Claims;
using System.Security.Principal;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;

namespace B.S.DataBasic.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UserController : ControllerBase
    {
        private readonly IMediator mediator; 

        public UserController(   IMediator mediator )
        {  
            this. mediator = mediator;
        }
        [HttpGet]
        public async Task<APIResult<APIPaging<TranceDto>>> TranceShow([FromBody] ShowCommand login)
        {
            return await mediator.Send(login);
        }

        /// <summary>
        /// 
        /// </summary> 
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<Traceabilitable>>> GetAccounts(int trId)
        {
            ListCommand command = new ListCommand();
            command.TrId = trId;
            return await mediator.Send(command);
        }
    }
}
